#include<iostream>
#include<cmath>
using namespace std;

class complex
{
public:
       complex( double r = 0.0 , double i = 0.0 ) 
       {
           real = r ;
           imag = i ;         
       }
       complex operator + ( complex c2 );
       complex operator - ( complex c2 );
       void display();
private:      
       double real;
       double imag;
};

complex complex:: operator +(complex c2)
{
    complex c ;
    c.real = this->real + c2.real;
    c.imag = this->imag + c2.imag; 
    return c;
}

complex complex:: operator -(complex c2)
{
    complex c ;
    c.real = this->real - c2.real;
    c.imag = this->imag - c2.imag; 
    return c;//return c(c.real , c.imag);
}

void complex:: display()
{
    cout<<real<<( imag>=0?"+":"-" )<<abs(imag)<<"i"<<endl;
}

int main()
{
    complex a(1.1,2.2),b(3.3,4.4),c(5.5,6.6),d,e;    
    d = a + b;
    d.display();
    e = c - b;
    e.display();
    system("pause");
    return 0 ;
}





